
const mongoose = require('mongoose')


//创建集合规则 courseSchema 中就是集合的规则
const WorkSchema = new mongoose.Schema({

    work_username: {    // 用户呢称
        type: String,
        minlength: 2,
        maxlength:10,
        default: "匿名用户"
    },
    work_sex:{      // 性别
        type:String, 
    },
    work_xuehao:{   // 学号
        type:String,
        minlength: 5,
        maxlength:15,
        unique:true
    },
    work_zhuanye: {     // [学院,专业]
        type: Array,
        required: true
    },
    work_fangshi: {     // 培养方式
        type: String,
        minlength: 0,
        maxlength:10,
        required: true
    },
    work_xuezhi: {      // 学制 3/4
        type: String,
        minlength: 0,
        maxlength:5,
        required: true
    },
    work_xueli: {      // 学历 
        type: String,
        minlength: 0,
        maxlength:10,
        required: true
    },
    work_shengyuan: {    // 生源地区 [省，市，县]
        type: Array,
        required: true
    },
    work_kun_grade: {    // 困难级别
        type: String,
        minlength: 0,
        maxlength:10,
        required: true
    },
    work_jiuye: {      // 就业情况
        type: String,
        minlength: 0,
        maxlength:10,
        required: true
    },
    work_danwei: {      // 单位名称
        type: String,
        minlength: 0,
        maxlength:30,
        default: "升学"
    },
    work_dizhi: {    // 单位所在省份或市
        type: Array,
        default:["升学"]
    },
    work_biye_time:{    // 毕业时间
        type:String,
        required: true
    }

})

//使用规则创建集合
const Work = mongoose.model("Work", WorkSchema) //courses文件名 ,以上部分可以看成创建了一个类


module.exports = {
    Work
}